home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1999 November
/
Macworld (1999-11).dmg
/
Updaters
/
WhiteCap 3.0.4
/
WhiteCap Source.sit
/
WhiteCap Source
/
Common
/
General Tools
/
Headers
/
XStrList.h
< prev
next >
Wrap
Text File
|
1999-07-13
|
1KB
|
51 lines
#ifndef _XSTRLIST_
#define _XSTRLIST_
#include "XPtrList.h"
enum XStrListOptsT {
cDuplicatesAllowed,
cNoDuplicates_CaseSensitive,
cNoDuplicates_CaseInsensitive
};
class XStrList {
public:
XStrList( XStrListOptsT inOption, ListOrderingT inOrdering = cOrderNotImportant );
virtual ~XStrList();
// Returns what index the copy of the given string now occupies (1-based indexing). If 0 is returned,
// a copy of the string was not added because it was a duplicate (if that flag is on)
long Add( const void* inData, long inLen );
long Add( const char* inStr );
long Add( const UtilStr& inStr );
void RemoveAll();
void Remove( long inIndex );
// Look for an item with a matching name. If 0 is returned, no item was found.
virtual long FindIndexOf( const char* inStr ) const;
long FindIndexOf( const UtilStr& inStr ) const;
// Returns a copy of the string's contents
bool Fetch( long inIndex, UtilStr& outStr ) const;
// Returns direct access to the string (it cannot be changed)
const UtilStr* Fetch( long inIndex ) const;
inline long Count() const { return mStrings.Count(); }
protected:
static int sStrComparitor( const void* inA, const void* inB );
static int sStrComparitorCI( const void* inA, const void* inB );
XStrListOptsT mStrListOption;
XPtrList mStrings;
};
#endif